#!/usr/bin/python
# -*- coding: utf-8 -*-

# @File        :   weather_flag.py
# @Version     :   1.0
# @Author      :   zhfns
# @Email       :   mklv2005@163.com
# @Time        :   2022-02-22 16:50
# Description  :

from datetime import datetime

from sqlalchemy import Column, Date, String, Integer
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()


class WeatherFlag(Base):
    __tablename__ = 'weather_flag'
    id = Column(Integer, primary_key=True, autoincrement=True, comment='序列')
    # 天气名称，如雷雨，中雨~大雨等
    flag_name = Column(String(32), comment='城市名称')
    # 创建时间
    gmt_create = Column(Date(), default=datetime.now, comment='创建时间')
    # 最后操作时间
    gmt_modified = Column(Date(), onupdate=datetime.now, comment='最后操作时间')

    def __repr__(self):
        return 'WeatherFlag(id={}, flag_name={}, gmt_create={}, gmt_modified={})'.format(
            self.id, self.flag_name, self.gmt_create, self.gmt_modified
        )